<template>
    <div>
        <a-modal
            v-model:visible="visible"
            :title="currentData.fsxmc"
            width="100%"
            wrapClassName="full-modal-material-review"
            :maskClosable="false"
            :destroyOnClose="true"
            :forceRender="true"
        >
            <a-spin size="large" :spinning="spinning" :key="spinningKey">
                <div class="reviewVerificationManage-allHandlingPage-modal-v" style="height: calc(100vh - 68px);">
                    <div class="top-handle-v">
                        <div style="font-weight: 600;font-family: KaiTi !important;color: #38f;display: flex;align-items: center;">
                            <!-- {{ currentData.fhjmc }} -->
                            <div>
                                <span v-if="currentData.fhjmc" style="display: inline-block;border:2px solid #ff9200;padding: 0 5px;border-radius: 17.3px;color: #ff9200;margin-right: 10px;font-size: 18px;">{{ currentData.fhjmc }}</span>
                                <span>{{ currentData.fqymc }}</span>888
                            </div>
                            <span v-if="currentData.fslbh" style="display: inline-block;border:2px solid #4eef66;padding: 0 5px;border-radius: 17.3px;color: #4eef66;margin-left: 10px;font-size: 14px;">{{ currentData.fslbh }}</span>
                        </div>
                        <div style="display: flex;align-items: center;" v-if="!currentData.isHandle" >
                            <div>
                                <a-button v-if="$refs.handleComprehensiveRef && $refs.handleComprehensiveRef.activeKey == '企业整改材料'" style="margin-left: 10px;" @click="rectificationClick('pushQyBcZgNotice')" icon="profile">发起整改</a-button>
                                <a-button v-if="$refs.handleComprehensiveRef && $refs.handleComprehensiveRef.activeKey == '企业整改材料'" style="margin-left: 10px;" @click="historyListClick('querySqsxBczgjlHistoryList')" icon="clock-circle">整改历史记录</a-button>
                                <a-button style="margin-left: 10px;" class="blue-btn" type="primary" @click="linkHandling('spcysubmitFlow')" icon="edit">提交</a-button>
                                <a-button style="margin-left: 10px;" icon="rollback" @click="returnPreviousLink('spcyreturnUpperFlowJob')">退回</a-button>
                                <!-- <a-button style="margin-left: 10px;" class="blue-btn" type="primary" icon="interaction" @click="internalTransferClick('spcytransferFlowJob')">内部转办</a-button> -->
                            </div>
                            <div style="margin-left: 50px;">
                                <a-button style="margin-right: 10px;" type="primary" @click="applicationInfoClick()" icon="file-text" ghost >申请信息</a-button>
                                <a-button class="blue-btn" type="primary" @click="refreshClick()" icon="reload">刷新</a-button>
                                <a-button style="margin-left: 10px;" @click="returnClick()" icon="close"></a-button>
                            </div>
                        </div>
                    </div>
                    <!-- <div style="height: 53px;"></div> -->
                    <div style="width: 100%;display: flex;margin-top: 8px;">
                        <!-- <div style="height: calc(100vh - 70px);width: 140px;background-color: #fff;padding: 10px;">
                            <commpStep :parameterData="{index:6}"></commpStep>
                        </div> -->
                        <!--  style="width: calc(100% - 150px);margin-left: 10px;" -->
                        <div style="width: 100%;">
                            <handleComprehensive ref="handleComprehensiveRef" @rectificationClick="rectificationClick" @historyListClick="rectificationClick" />
                        </div>
                        
                    </div>
                </div>
            </a-spin>
            <processingConditionsAll ref="processingConditionsAllRef" :processingData="processingData" @interfaceSuccessful="interfaceSuccessful"></processingConditionsAll>
            <supplementaryRectification ref="supplementaryRectificationRef" @rectificationSuccess="rectificationSuccess"/>
            <supplementaryHistory ref="supplementaryHistoryRef"/>
            <a-modal
                :dialog-style="{ top: '20px' }"
                title="查看申请信息"
                :visible="applicationVisible"
                @ok="applicationVisible = false"
                @cancel="applicationVisible = false"
                :footer="null"
                :width="1500"
                class="application-modal-box"
            >
                <a-spin size="large" :spinning="modalSpinningPrice" tip="正在加载中...">
                    <eventSet :key="eventSetKey" ref="eventSetRef" @updatedSuccess="eventupdatedSuccess"/>
                </a-spin>
            </a-modal>
        </a-modal>
    </div>
</template>
<script>
import handleComprehensive from './handleComprehensive.vue'
import eventSet from '../taskAcceptance/eventSet.vue'
export default {
    components:{
        handleComprehensive,
        eventSet,
    },
    props:{

    },
    data(){
        return{
            visible:false,
            spinning:false,
            processingData:{},
            currentData:{},
            spinningKey:null,
            applicationVisible:false,
            modalSpinningPrice:false,
            eventSetKey:null,
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        getData(row){
            this.cancelLoading()
            this.currentData = row
            this.$nextTick(()=>{
                this.$refs.handleComprehensiveRef.getData(row)
            })
            
        },
        returnClick(){//返回
            this.visible = false
        },
        //申请信息
        applicationInfoClick(){
            this.applicationVisible = true
            this.$nextTick(()=>{
                this.$refs.eventSetRef.getDatas({...this.currentData,tabPaneActiveKey:'申请信息',modelHeight:true})
                this.modalSpinningPrice = true
            })
        },
        eventupdatedSuccess(){
            this.modalSpinningPrice = false
        },
        refreshClick(){//刷新
            this.$emit('reviseClick',{...this.currentData,noFirstLoad:false,isActiveKey:this.$refs.handleComprehensiveRef.activeKey})
            this.spinning = true
            this.spinningKey = Date.now()
            this.cancelLoading()
        },
        cancelLoading(){
            let timer = setInterval((val)=>{
                this.spinning = false
                clearInterval(timer);
            },500)
            
        },
        successReturn(val){
            this.visible = val
            this.$emit('successReturn')
        },
        //提交到方案制定
        linkHandling(val){
            // let result = this.$refs.handleComprehensiveRef.auditStatus 
            let result = true
            // if(result == '已审核'){
                this.$refs.processingConditionsAllRef.processingConditionsVisible = true
                let data = {
                    interface:val,
                    sqsxid:this.currentData.sqsxid,
                    nextNodeDbrList:this.currentData.nextNodeDbrList,
                    nextNode:this.currentData.nextNode,
                    jobid:this.currentData.jobid,
                    headerLeftTitle:'提交',
                    headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
                    otherData:{
                        // fscms:'技术审评',
                    },
                    isBlr:this.currentData.fhjmc=='综合评定'?true:false,
                    isNew:true,
                    isYwbmjbr:this.currentData.fhjmc=='移送确认'?true:false,
                }
                this.processingData = data
                this.$refs.processingConditionsAllRef.getData(data)
            // }else{
            //     this.$message.warning('材料未全部审核')
            // }
        },
        //提交到综合评定
        linkHandlingTwo(val){
            //  
            // let result = this.$refs.planProductionRef.sceneSubmitClick('技术审评')
            // if(result){
                this.$refs.processingConditionsAllRef.processingConditionsVisible = true
                let data = {
                    interface:val,
                    sqsxid:this.currentData.sqsxid,
                    nextNodeDbrList:this.currentData.nextNodeDbrList,
                    nextNode:'综合评定',
                    jobid:this.currentData.jobid,
                    headerLeftTitle:'提交到综合评定',
                    headerCenterTitle:'药品生产查验--材料审查',
                    isBlr:false,
                    otherData:{
                        // fscms:'技术审评',
                        nextNode:'综合评定',
                    },
                    isNew:true,
                }
                this.processingData = data
                this.$refs.processingConditionsAllRef.getData(data)
            // }

        },
        //退回
        returnPreviousLink(val){
            this.$refs.processingConditionsAllRef.processingConditionsVisible = true
            let data = {
                interface:val,
                sqsxid:this.currentData.sqsxid,
                nextNodeDbrList:this.currentData.nextNodeDbrList,
                nextNode:this.currentData.nextNode,
                jobid:this.currentData.jobid,
                isBlr:false,
                isThhj:true,
                isXyb:false,
                headerLeftTitle:'退回',
                headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
                isNew:true,
                NoViewBlr:true,
            }
            this.processingData = data
            this.$refs.processingConditionsAllRef.getData(data)
        },
        //内部转办
        internalTransferClick(val){
            this.$refs.processingConditionsAllRef.processingConditionsVisible = true
            let data = {
                interface:val,
                sqsxid:this.currentData.sqsxid,
                jobid:this.currentData.jobid,
                isBlyj:true,
                isZbxx:false,
                isXyb:false,
                isNbbl:true,
                isBlr:false,
                NoViewBlr:true,
                headerLeftTitle:'内部转办',
                headerCenterTitle:'药品生产查验--'+this.currentData.fhjmc,
            }
            this.processingData = data
            this.$refs.processingConditionsAllRef.getData(data)
        },
        rectificationClick(val){
            this.$refs.supplementaryRectificationRef.visible = true
            this.$refs.supplementaryRectificationRef.getData(
                {interfaceValue:val,modalTitle:'企业整改',isTextMessage:true,fsqsxid:this.currentData.sqsxid,opinionText:'缺陷项目',
                isTime:true,jobid:this.currentData.jobid},
                {opinion:'fzgyj',timeLimit:'fzgsx'}
            )
        },
        historyListClick(val){
            this.$refs.supplementaryHistoryRef.visible = true
            this.$refs.supplementaryHistoryRef.getData({interfaceValue:val,modalTitle:'企业整改历史',sqsxid:this.currentData.sqsxid})
        },
        rectificationSuccess(){

        },
        //提交成功后
        interfaceSuccessful(){
            this.successReturn(false)
        },
    }
}
</script>
<style lang="less">
.full-modal-material-review {
    .ant-modal-title{
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
  .ant-modal {
    max-width: 100%;
    top: 0;
    padding-bottom: 0;
    margin: 0;
  }
  .ant-modal-content {
    display: flex;
    flex-direction: column;
    height: calc(100vh);
    // background: #fff;
  }
  .ant-modal-body {
    flex: 1;
    background: #f4f7fc !important;
    padding: 0px;
    height: calc(100vh - 50px);
    overflow: auto;
  }
  .ant-modal-footer{
    display: none;
  }
}
</style>